<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <title>高级标签</title>
    <link rel="stylesheet" type="text/css" href="./js/ext/resources/css/ext-all.css" />    
    <!-- GC -->
 	<!-- LIBS -->
 	<script type="text/javascript" src="./js/ext/adapter/ext/ext-base.js"></script>
 	<!-- ENDLIBS -->

    <script type="text/javascript" src="./js/ext/ext-all-debug.js"></script>

    <!-- Tabs Example Files -->
<!--     <link rel="stylesheet" type="text/css" href="tabs-example.css" />  -->   
<SCRIPT LANGUAGE="JavaScript">
<!--
	Ext.onReady(function(){
		Ext.QuickTips.init();
		Ext.state.Manager.setProvider(new Ext.state.CookieProvider());
		Ext.apply(Ext.util.Format,{
			actions: function(v){
				return '<a href="#">'+v+'</a>';
			}
		});

		Ext.Ajax.request({
			url: 'server/dynamic_header.php',
			success: function(response,selfobj){
				var a = response.responseText;
				var json = new Ext.util.JSON.decode(a);
				
				//json store data
				var store = new Ext.data.JsonStore({
					url: './server/s.php',
					root: 'root',
					totalProperty: 'total',
					fields: json.fieldsNames
				});
				store.load({params:{start:0, limit:25}});//{params:{start:0, limit:25}}
				//grid
				var col = [
						{id:'company',header: "公司", width: 160, sortable: true, dataIndex: 'company'},
						{header: "价格", width: 75, sortable: true, renderer: 'usMoney', dataIndex: 'price'},
						{id:'opid',header: "操作", width: 75, sortable: true, renderer: actions, dataIndex: 'op'}
					];
				
				if(Ext.isGecko3){
					console.log(col);
					console.log(json.columModle);
				}
				var grid = new Ext.grid.GridPanel({
					store: store,					
					//columns: col,
					columns:json.columModle,
					stripeRows: true,
					autoExpandColumn: 'opid',
					height:350,
					width:600,
					title:'资料列表'			
					,bbar: new Ext.PagingToolbar({
						pageSize: 25,
						store: store,
						displayInfo: true,
						displayMsg: 'Displaying topics {0} - {1} of {2}',
						emptyMsg: "No topics to display"
					})
				});
				grid.render("mygrid");

			},
		    failure: function(){
				Ext.Msg.alert('msg','error');
			}
		});
		

		
	});
//-->
</SCRIPT>
</head>
<body>
	<div id='mygrid' style="padding:15px;padding-left:35px"></div>
</body>
</html>